<%-- 
    Document   : Editar
    Created on : 05-23-2013, 08:48:16 PM
    Author     : Urena
--%>

<%@page import="Model.Customer"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <h1><center>EDITAR</center></h1>
        <br>
        <form action="FormularioServlet" method="post">

            <%
                Customer cust = (Customer) request.getAttribute("Customer");
                
                
                String Editar =
                        "Nombre:"
                        + "<br>"
                        + "<input type=\"text\" name=\"name\" value=\"" + cust.getName() + "\" maxlength=\"30\">"
                        + "<br>"
                        + "Apellido:"
                        + "<br>"
                        + "<input type=\"text\" name=\"lastname\" value=\"" + cust.getLastname() + "\" maxlength=\"30\">"
                        + "<br>"
                        + "Direccion"
                        + "<br>"
                        + "<input type=\"text\" name=\"address\" value=\"" + cust.getAddress() + "\"maxlength=\"100\" size = \"60\">"
                        + "<br>"
                        + "Telefono:"
                        + "<br>"
                        + "<input type=\"text\" name=\"phone\" maxlength=\"10\" value=\"" + cust.getPhone() + "\">"
                        + "<br>"
                        + "Sex:"
                        + "<br>";

                if (cust.getSex().equals("male")) {

                    Editar += "<select name=\"sex\">"
                            + "<option value=\"male\" selected=\"selected\">M</option>"
                            + "<option value=\"female\" >F</option>"
                            + "</select>";
                } else {

                    Editar += "<select name=\"sex\">"
                            + "<option value=\"female\" selected=\"selected\">F</option>"
                            + "<option value=\"male\" >M</option>"
                            + " </select>";

                }

                Editar += "<br>"
                        + "Email:"
                        + "<br>"
                        + "<input type=\"text\" name=\"email\" maxlength=\"100\" value=\"" + cust.getEmail() + "\">"
                        + "<br>"
                        + "Contrasena:"
                        + "<br>"
                        + "<input type=\"password\" name=\"password\" maxlength=\"10\"value=\"" + cust.getPassword() + "\">"
                        + "<br>"
                        + "<input type=\"hidden\" name=\"id\" value=\""+ cust.getId()+ "\">";


            %>


            <%= Editar%>

            <input type="submit" name="todo" value="Guardar"> 

        </form>

    </body>
</html>
